#ifndef SYSINFO_H
#define SYSINFO_H

#include <QFrame>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QProgressBar>
#include "progressbar.h"
#include <QLabel>

class SysInfo : public QFrame
{
    Q_OBJECT
public:
    explicit SysInfo(QWidget *parent = 0);
    
    /* We will Read CPU info */
    double read_cpu();

    /* We also Read Mem Info */
    double read_mem();

    void update_info_gui(double &cpu_percent, double &mem_percent);

private slots:
    void show_win()
    {
        if(this->isHidden()) {
            this->show();
            this->setFocus();
            emit show_change_mainwindow_size();
        } else {
            this->hide();
            emit hide_change_mainwindow_size();
        }
    }

protected :
    void focusOutEvent(QFocusEvent *);

signals:
    void hide_change_mainwindow_size();
    void show_change_mainwindow_size();

private:
    int old_cpu_inuse;
    int old_cpu_total;

private:
    /* Layout */
    QVBoxLayout m_cpu_layout;
    QVBoxLayout m_mem_layout;

    QHBoxLayout m_main_layout;

    /* Label */
    QLabel m_cpu_label;
    QLabel m_mem_label;

    /* ProgressBar */
    QProgressBar m_cpu_bar;
    ProgressBar m_mem_bar;
};

#endif // SYSINFO_H
